
// - -------------------------------------------------------------------------------------------------------------- - //
function Log( val ) {
	if ( 'createTouch' in document ) {
		setTimeout( function() { document.getElementById("HTMLLog").innerHTML += val + "<br />"; }, 50 );
	}
	else {
		console.log( val );
	}
}
// - -------------------------------------------------------------------------------------------------------------- - //
function NextPowerOfTwo( v ) {
	// http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 //
	v--;
	v |= v >> 1;
	v |= v >> 2;
	v |= v >> 4;
	v |= v >> 8;
	v |= v >> 16;
	v++;
	
	return v;
}
// - -------------------------------------------------------------------------------------------------------------- - //

// - -------------------------------------------------------------------------------------------------------------- - //
// Utility Functions //
// - -------------------------------------------------------------------------------------------------------------- - //
function Util_IndexXY( _x, _y ) {
	return _x + (_y * this.width);
}
// - -------------------------------------------------------------------------------------------------------------- - //
function Util_GetXY( _x, _y ) {
	return this.Data[ _x + (_y * this.width) ];
}
// - -------------------------------------------------------------------------------------------------------------- - //
function Util_SetXY( _x, _y, _value ) {
	this.Data[ _x + (_y * this.width) ] = _value;
}
// - -------------------------------------------------------------------------------------------------------------- - //
